import { Connection } from 'mongoose';
import { getInstance } from '../../db';
import { videoSchema } from '../../schemas/videoSchema';

export const getVideoDetailService = async (params: IAnyObject): Promise<IAnyObject> => {
  const db: Connection = await getInstance();
  const videoModel = db.model('video', videoSchema);

  const { id } = params;

  const condition = {
    _id: {
      $eq: id,
    },
  }

  const result = await videoModel.find(condition);

  return result;
}